package com.iss.view.room;

import com.iss.controller.RoomController;
import com.iss.model.Room;
import com.iss.view.Index;
import com.iss.view.view.ConsoleTable;
import com.iss.view.view.RoomTable;
import com.iss.view.view.Window;

import java.util.List;
import java.util.Scanner;
import java.util.logging.Logger;

public class ListWindow extends Window {


    private RoomController controller = new RoomController();
    private ConsoleTable<Room> table = new RoomTable();

    @Override
    public String print() {


        String cmd = "";
        System.out.println("房间列表：");
        // 打印房间列表
        List<Room> list = this.controller.getList();

        table.printHeader();
        table.toTable(list);

        System.out.print("命令提示：1.继续(C);");
        System.out.print("请输入你的命令：");
        Scanner scanner = new Scanner(System.in);
        cmd = scanner.next();
        return cmd;
    }

    @Override
    public Window getNextWindow(String cmd) {

        if (this.cmd.equals("C")) {
            return new Index();
        }
        return null;
    }
}
